package com.brainshare.system.service.impl;

import com.brainshare.common.utils.DateUtils;
import com.brainshare.system.domain.AnRedPacketRecord;
import com.brainshare.system.mapper.AnRedPacketRecordMapper;
import com.brainshare.system.service.IAnRedPacketRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 筛查领红包记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-08-15
 */
@Service
public class AnRedPacketRecordServiceImpl implements IAnRedPacketRecordService 
{
    @Autowired
    private AnRedPacketRecordMapper anRedPacketRecordMapper;

    /**
     * 查询筛查领红包记录
     * 
     * @param id 筛查领红包记录主键
     * @return 筛查领红包记录
     */
    @Override
    public AnRedPacketRecord selectAnRedPacketRecordById(Long id)
    {
        return anRedPacketRecordMapper.selectAnRedPacketRecordById(id);
    }

    /**
     * 查询筛查领红包记录列表
     * 
     * @param anRedPacketRecord 筛查领红包记录
     * @return 筛查领红包记录
     */
    @Override
    public List<AnRedPacketRecord> selectAnRedPacketRecordList(AnRedPacketRecord anRedPacketRecord)
    {
        return anRedPacketRecordMapper.selectAnRedPacketRecordList(anRedPacketRecord);
    }

    /**
     * 新增筛查领红包记录
     * 
     * @param anRedPacketRecord 筛查领红包记录
     * @return 结果
     */
    @Override
    public int insertAnRedPacketRecord(AnRedPacketRecord anRedPacketRecord)
    {
        anRedPacketRecord.setCreateTime(DateUtils.getNowDate());
        return anRedPacketRecordMapper.insertAnRedPacketRecord(anRedPacketRecord);
    }

    /**
     * 修改筛查领红包记录
     * 
     * @param anRedPacketRecord 筛查领红包记录
     * @return 结果
     */
    @Override
    public int updateAnRedPacketRecord(AnRedPacketRecord anRedPacketRecord)
    {
        anRedPacketRecord.setUpdateTime(DateUtils.getNowDate());
        return anRedPacketRecordMapper.updateAnRedPacketRecord(anRedPacketRecord);
    }

    @Override
    public int updateAnRedPacketRecord(List<Long> idList, String updateUser, Date updateTime) {
        return anRedPacketRecordMapper.updateAnRedPacketRecordByIds(idList,updateUser,updateTime);
    }

    /**
     * 批量删除筛查领红包记录
     * 
     * @param ids 需要删除的筛查领红包记录主键
     * @return 结果
     */
    @Override
    public int deleteAnRedPacketRecordByIds(Long[] ids)
    {
        return anRedPacketRecordMapper.deleteAnRedPacketRecordByIds(ids);
    }

    /**
     * 删除筛查领红包记录信息
     * 
     * @param id 筛查领红包记录主键
     * @return 结果
     */
    @Override
    public int deleteAnRedPacketRecordById(Long id)
    {
        return anRedPacketRecordMapper.deleteAnRedPacketRecordById(id);
    }

    @Override
    public int deleteAnRedPacketRecordByUserId(Long userId) {
        return anRedPacketRecordMapper.deleteAnRedPacketRecordByUserId(userId);
    }
}
